ImagXpress 13 for ActiveX - User Guide > How To > View an Image > Capture, Copy & Paste > Select a Section of the Displayed Image |
ImagXpress® enables the user to select a section of the image that is being viewed. This section, referred to as a Rubberband, can then be used in a variety of ways: for example, copied to another control or buffer, or selected as a region to process.
To use a rubberband:
VB Example |
Copy Code
|
---|---|
' Activate the rubberband when the user first clicks the mouse Private Sub ImagXpress1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) ' CLEAR ANY EXISTING RUBBER BANDING REGION ImagXpress1.RubberBand False, X, Y, False ' CONVERT X & Y TO PIXELS X = X / Screen.TwipsPerPixelX Y = Y / Screen.TwipsPerPixelY ' TURN THE RUBBER BANDING ON, SET THE STARTING POINT ImagXpress1.RubberBand True, X, Y, False End Sub ' Track the user's changes whenever they move the mouse Private Sub ImagXpress1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' UPDATE THE RUBBER BAND X = X / Screen.TwipsPerPixelX Y = Y / Screen.TwipsPerPixelY ImagXpress1.RubberbandUpdate X, Y End Sub ' Do something with the region when the user lifts off the mouse Private Sub ImagXpress1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim xpos, ypos, w, h As Integer ' YOU CAN DO ANYTHING WITH, OR TO, THE REGION THE USER HAS SELECTED. IN THIS EXAMPLE, WE WILL ' COPY THE AREA TO ANOTHER CONTROL. ImagXpress2.hDib = ImagXpress1.CopyRubberbandDib ImagXpress2.ZoomToFit ZOOMFIT_BEST ' TURN THE RUBBER BAND OFF ImagXpress1.RubberBand False, X, Y, False End Sub |
ImagXpress provides capability to create and use a sprite. A sprite is created by copying a part of the displayed image into a transparent window. This window can be moved or pasted within the image view. To create and use a sprite:
Even if the viewer is assigned a different image to display, the Sprite remains in effect and can be moved or pasted in the new image being viewed. Therefore, sprites can be used to merge images. |
Deleting the sprite does not result in any changes to the image being viewed. |